package edu.sysu.emf.extendedEcore.CodeGen;

import java.io.File;

import org.eclipse.emf.ecore.DSManagementInterface;
import org.eclipse.core.runtime.*;

public abstract class AbstractGenerator{
	
	String projectName;
	
	public static AbstractGenerator getInstance() {
		return null;
	}	
	
	public void setProjectName(String projectName){
		this.projectName = projectName;
	}
	
	public String getProjectName(){
		return this.projectName;
	}
	
	public abstract void actionGen(String className,DSManagementInterface managementInterf);
	
	public String getClassName(String str){
		String first = str.substring(0, 1).toUpperCase();
		String rest = str.substring(1, str.length());
		return new StringBuffer(first).append(rest).toString(); 
	}
	
	public String filePath(String fileName){
		String workspacePath = Platform.getLocation().toString();
		File file = new File(workspacePath+"/"+getProjectName()+".editor/src/RuntimeDataUpdate/impl");
		if(!file.exists()) file.mkdirs();
		return file.toString()+"/"+fileName+".java";
	}
}
